<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function checkUserName(userName) {
            
            if (userName.length < 3 || userName.length > 10) {
                alert("长度为3~10")
                return false
            }
             //Admin  ADMIN -> admin
            if (userName.toLocaleLowerCase().indexOf("admin") >= 0) {
                alert("不能包含admin")
                return false
            }
            return true
        }
       var name = prompt("请输入用户名")
       var r =  checkUserName(name)
        
    </script>
</body>

</html>